package com.nextar.ui;

import com.vaadin.ui.MenuBar;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.MenuBar.Command;
import com.vaadin.ui.MenuBar.MenuItem;

public class MainMenuBar extends VerticalLayout{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1815449509539316482L;
	private MenuBar menubar = new MenuBar();

    public MainMenuBar() {

        // Save reference to individual items so we can add sub-menu items to
        // them
        final MenuBar.MenuItem file = menubar.addItem("Admin", null);
        final MenuBar.MenuItem doctorItem = file.addItem("Doctors", null);
        final MenuBar.MenuItem pharmacyItem = file.addItem("Pharmacy", null);        
        file.addSeparator();

        doctorItem.addItem("Add Doctors", menuCommand);
        doctorItem.addItem("View Doctors", menuCommand);
        
        pharmacyItem.addItem("Add Pharmacy", menuCommand);
        pharmacyItem.addItem("View Pharmacy", menuCommand);

        file.addItem("Close", menuCommand);
        file.addItem("Close All", menuCommand);
        file.addSeparator();
        
        addComponent(menubar);
    }

    private Command menuCommand = new Command() {
        /**
		 * 
		 */
		private static final long serialVersionUID = -8760879346493841675L;

		public void menuSelected(MenuItem selectedItem) {
            getWindow().showNotification("Action " + selectedItem.getText());
        }
    };
}
